﻿using JinYuan.MES.Enums;
using JinYuan.MES.Models;
using JinYuan.Models;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace JinYuan.MES
{
    /// <summary>
    /// MES接口
    /// </summary>
    public interface IMes
    {
        /// <summary>
        /// 登录接口
        /// </summary>
        Task<(bool Success, string Message, string MesUserLevel)> LoginEnyityAsync(string url, string siteCode, string lineCode, string equipNum, string userName, string passWord);

        Task<(bool Success, string Message)> LoginEnyityAsync(string url, string siteCode, string lineCode, string equipNum, string UserCardID);

        /// <summary>
        /// 设备参数设定值请求接口
        /// </summary>
        Task<(ParamReturnData Data, string Mesage)> GetParamSetRequestAsync(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName);

        /// <summary>
        /// 参数设定值变更接口
        /// </summary>
        Task<(bool Success, string ResJson)> ParamChangeAsync(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, List<TagListItem> paramChangeItems);

        /// <summary>
        /// 单个上传（只上传条码，不上传卷芯码）
        /// </summary>
        Task<(bool Success, string Mesage, MesResType MesResType)> SingleCellInStationAsync(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, string BarCode);

        /// <summary>
        /// 复投单个上传（只上传条码，不上传卷芯码）
        /// </summary>
        Task<(bool Success, string MesMessage, MesResType MesResType)> SingleFTCellInStationAsync(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, string BarCode);

        /// <summary>
        /// 电芯进站接口(多个)
        /// </summary>
        Task<(bool Success, List<string> MesMessage, List<MesResType> MesResType)> ManyCellInStationAsync(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, List<string> listBar);

        Task<(bool Success, List<string> MesMessage, List<MesResType> MesResType, List<string> CellCode)> ManyCellInStationAsync1(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, List<string> listBar);

        /// <summary>
        /// 电芯出站接口(多个)
        /// </summary>
        Task<(bool Success, List<string> MesMessage, List<MesResType> MesResType)> OutboundInformationsAsync(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, List<BGearEntity> listBar);

        /// <summary>
        /// 组装出站(单电池)
        /// </summary>
        /// <param name="url"></param>
        /// <param name="siteCode"></param>
        /// <param name="lineCode"></param>
        /// <param name="equipNum"></param>
        /// <param name="materialCode"></param>
        /// <param name="userName"></param>
        /// <param name="m"></param>
        /// <param name="type"></param>
        /// <param name="materialLotCodeLocator"></param>
        /// <returns></returns>
        Task<(bool Success, string Mesage, MesResType MesResType)> SingleCellInAndOutStationAsync(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, BGearEntity m, int type, string materialLotCodeLocator);


        /// <summary>
        /// 原材料上传
        /// </summary>
        /// <param name="url"></param>
        /// <param name="MaterialCode"></param>
        /// <param name="equipNum"></param>
        /// <param name="BarCode"></param>
        /// <param name="resJson"></param>
        /// <param name="mesResType"></param>
        /// <returns></returns>
        Task<(bool Success, string MesMessage, MesResType MesResType)> RawMaterialStationAsync(string url, string MaterialCode, string equipNum, string BarCode);
        /// <summary>
        /// 产品过程加工参数接口
        /// </summary>
        Task<(bool Success, string ResJson)> ProductProcessParamAsync(string url, string siteCode, string userName, string equipNum, string lineCode, string materialCode, MesUploadType unloadType, List<ProductProcessParam> productProcessParam);

        /// <summary>
        /// 产品结果加工参数接口
        /// </summary>
        Task<(bool Success, string ResJson)> ProducResultParamAsync(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, BGearEntity m, MesUploadType unloadType, string insertTime);

        /// <summary>
        /// 单电芯出站
        /// </summary>
        Task<(bool Success, string Mesage, MesResType MesResType)> SingleCellOutStationAsync(string url, string siteCode, string lineCode, string equipNum, string modelName, string materialCode, string userName, BGearEntity m, int type, string materialLotCodeLocator);

        /// <summary>
        /// 多电芯出站接口
        /// </summary>
        Task<(bool Success, List<string> MesMessage, List<MesResType> MesResType)> ManyCellOutStationAsync(string url, string siteCode, string lineCode, string equipNum, string modelName, string materialCode, string userName, List<BGearEntity> m, int type, string materialLotCodeLocator);

        /// <summary>
        /// 设备运行状态接口
        /// </summary>
        Task<(bool Success, string ResJson)> UploadEquStatusAsync(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, string guid, string statusCode, List<FaultCodeList> faultCodes);

        /// <summary>
        /// 设备报警接口
        /// </summary>
        Task<(bool Success, string Mesage)> UploadEquAlarmAsync(string url, string siteCode, string lineCode, string equipNum, string materialCode, string userName, List<AlarmData> alarmObj, string guid);

        /// <summary>
        /// 能耗数据上传
        /// </summary>
        Task<(bool Success, string Mesage)> UploadEquEnergyAsync(string url, string siteCode, string lineCode, string equipNum, string userName, List<string> electricMeterNum, List<WattrMeter> wattrs);

        /// <summary>
        /// 风速仪数据上传
        /// </summary>
        Task<(bool Success, string Mesage)> UploadDeviceCollectDataAsync(string url, string equipNum, List<string> antiDustAirSpeedNum, List<float> collectData);
    }
}
